import React, { Component } from 'react';
import {
    AppRegistry,
    StyleSheet,
    Text,
    View,
    ListView,
    Image,
    TouchableOpacity,
    Platform,
    AsyncStorage
} from 'react-native';

var NavigatorBar = require('../Main/NXNavigationBar'); //NavigationBar
var NetUitl = require('../Main/NXFetch');
var Login = require('../Mine/NXLogin');
var Find = React.createClass({
    getInitialState(){
        return {
            isCollect:true,
        }
    },
    render() {
        return (
            <View style={styles.container}>
                <NavigatorBar title='发现' widthWH={Platform.OS == 'ios' ? 25:25} leftBtnName = 'r_news_0' rightBtnName = 'r_news_0' leftpress={()=>this.leftAction()} rightPress={()=>this.rightAction()}  />
                <Text style={styles.welcome}>
                    发现
                </Text>
            </View>
        );
    },
    backImg(){
        if (this.state.isCollect == true){
            return 'hearts_icon'
        }else{
            return 'h_Hearts_icon'
        }
    },
    leftAction(){
        this.props.navigator.push(
            {
                component: Login
            }
        );
    },
    rightAction(){
        //formData就是参数
        // let formData = new FormData();
        // formData.append("product_id", " ");
        // formData.append("uploadImgId", " ");
        NetUitl.post('http://www.pintasty.cn/user/personinfo','',function (json) {
              console.log(json);
            },
            function () {
              console.log('没有登录')
            },
            function () {
               console.log('访问服务器错误')
            }
        )
    }
});


var styles = StyleSheet.create({
    container: {
        flex: 1,
        backgroundColor: '#F5FCFF',
    },
    welcome: {
        fontSize: 20,
        textAlign: 'center',
        margin: 10,
    },
    instructions: {
        textAlign: 'center',
        color: '#333333',
        marginBottom: 5,
    }
});

module.exports = Find;